//
//  main.m
//  AddressBook
//
//  Created by 小爪乎黑 on 14/11/27.
//  Copyright (c) 2014年 李帅. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "Person.h"
#import "AddressBook.h"

int main(int argc, const char * argv[])
{

    @autoreleasepool {
      
        
        //创建联系人
        
        Person *p1= [[Person alloc] initWithName:@"Lee" sex:@"n" phoneNum:@"123" age:10];
        Person *p2= [[Person alloc] initWithName:@"Mee" sex:@"n" phoneNum:@"133" age:3];
        Person *p3= [[Person alloc] initWithName:@"Lkk" sex:@"n" phoneNum:@"333" age:12];
        Person *p4= [[Person alloc] initWithName:@"Lee" sex:@"8" phoneNum:@"123" age:10];

        //初见通讯录
        AddressBook *ab = [[AddressBook alloc] init];
        
        //添加联系人
        [ab addPerson:p1];
        [ab addPerson:p2];
        [ab addPerson:p3];
        [ab addPerson:p4];

        

        
        //根据姓名删除联系人
        [ab deletePersonWithName:@"Lee"];
        
        //删除分组
        [ab deleteGroup:@"M"];
        
        
        NSLog(@"-------------%@",ab.addressBook);
        
        //根据电话查找联系人
        NSLog(@"person : %@ ",[ab findPersonWithPhoneNum:@"123"]);
        
        //根据性别查找联系人并排序
        NSLog(@"%@",[ab findPersonWithSex:@"n"]);
        
        //根据姓名修改联系人
        [ab changePersonWithName:@"Lee" phoneNum:@"222" sex:@"m" age:22];
        
        
        NSLog(@"-------------%@",ab.addressBook);
        
        
        //显示所有人
        
        [ab showAll];

        
        
 
        
        
    }
    return 0;
}

